﻿<UserControl x:Class="Tanis.Controls.RouteList"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
    mc:Ignorable="d"
    xmlns:loc="clr-namespace:Tanis.Controls"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    d:DesignHeight="480" d:DesignWidth="480"
    x:Name="RouteListUserControl">

    <UserControl.Resources>
        <loc:VisibilityConverter x:Key="VisibilityConverter" True="Visible" False="Collapsed"/>
    </UserControl.Resources>

    <Grid x:Name="LayoutRoot">
        <TextBlock Name="_infoMessage" Text="{Binding Path=LocalizedResources.NoRoutesFoundMessage, Source={StaticResource LocalizedStrings}}" Height="60" HorizontalAlignment="Left" Margin="12,12,0,0" Width="362" VerticalAlignment="Top" Visibility="Collapsed" TextWrapping="Wrap"/>

        <toolkit:PerformanceProgressBar Name="ppbRouteList" HorizontalAlignment="Left" 
                        Foreground="{Binding ElementName=RouteListUserControl, Path=ThemeDependantColorInverted}"
                        VerticalAlignment="Top"
                        Margin="0,-10,0,0"
                        Width="466" IsIndeterminate="True" 
                        Visibility="Collapsed"
                        />
        <ListBox Name="_routeListCtrl" >
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <Button Height="Auto" BorderBrush="{Binding ElementName=RouteListUserControl, Path=ThemeDependantColorInverted}"
                            Background="{Binding ElementName=RouteListUserControl, Path=ThemeDependantListBoxColor}" 
                            Width="450" Click="OnButtonClick">
                        <Button.Content>
                            <StackPanel Orientation="Vertical" Width="300" Name="_listItemStackPanel">
                                <TextBlock Name="Time" Foreground="{Binding ElementName=RouteListUserControl, Path=ThemeDependantColorInverted}" 
                                           Text="{Binding TimeSummary}"/>

                                <ItemsControl ItemsSource="{Binding Path=RouteDescriptionComposite}">
                                    <ItemsControl.ItemTemplate>
                                        <DataTemplate>
                                            <StackPanel Orientation="Horizontal">
                                                <TextBlock Text="{Binding Text}" Foreground="{Binding Color}" />
                                                <Image Source="{Binding ImagePath}"  />
                                            </StackPanel>
                                        </DataTemplate>
                                    </ItemsControl.ItemTemplate>
                                    <ItemsControl.ItemsPanel>
                                        <ItemsPanelTemplate>
                                            <toolkit:WrapPanel></toolkit:WrapPanel>
                                        </ItemsPanelTemplate>
                                    </ItemsControl.ItemsPanel>
                                </ItemsControl>    
                            </StackPanel>
 
                        </Button.Content>
                    </Button>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>
    </Grid>


</UserControl>



